

























/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import JCP.Browser;
import JCP.JavaClientPage;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.TransferHandler;




/**
 *
 * @author Pham
 */
public class Tester extends JPanel implements JavaClientPage {

    protected Browser br;
    protected Map<String, Object> parameters;
    JTextField field;
    JButton button;
    public Tester() {
    }
    public JPanel JavaClientPage = new JPanel();

    @Override
    public JPanel getBody() {

        ImageIcon icon = new ImageIcon("Logo2.png");
        JLabel lbicon = new JLabel(icon);
        JavaClientPage.add(lbicon);
        JMenuBar menuBar = new JMenuBar();
        menuBar.setBackground(Color.pink);
        JMenu home = new JMenu("Home");
        JMenu aboutus = new JMenu("About us");
        JMenu bioraphy = new JMenu("Bioraphy");
        JMenu gallery = new JMenu("Gallery");
        menuBar.add(home);
        menuBar.add(aboutus);
        menuBar.add(bioraphy);
        menuBar.add(gallery);
        JavaClientPage.add(menuBar);
        JLabel lbtest = new JLabel("This is first page");
        JLabel lbtest1 = new JLabel("Hello " + parameters.get("name"));
        JLabel lbtest2 = new JLabel("From" + parameters.get("city"));
        JavaClientPage.add(lbtest);
        JavaClientPage.add(lbtest1);
        JavaClientPage.add(lbtest2);
        /*  
        JButton bttestnext = new JButton("Next");
        JButton bttestback = new JButton("Back");
        bttestnext.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                br.go("http://localhost/test.Tester2?name=Pham&city=London");

            }
        });


        bttestback.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                br.go("http://localhost/test.Tester?name=Toan&city=London");
            }
        });

        JavaClientPage.add(bttestnext);
        JavaClientPage.add(bttestback);*/
        
       
       
        button = new JButton("Add me");
   
        field = new JTextField();
     field.setPreferredSize(new Dimension(40, 27));

        JavaClientPage.add(button);
        JavaClientPage.add(field);

        field.setDragEnabled(true);
        button.setTransferHandler(new TransferHandler("text"));
        
        
        
        
        return JavaClientPage;

    }

    @Override
    public void setBrowser(Browser br) {
        this.br = br;
    }

    @Override
    public void setParameters(Map<String, Object> parameters) {
        this.parameters = parameters;
    }
}
